import os

def delete_empty_txt_files(i_directory, l_directory):
    for file_name in os.listdir(i_directory):
        xxx = "jpg"
        if file_name.endswith(xxx):
            i_file_path = os.path.join(i_directory, file_name)
            l_file_path = os.path.join(l_directory, file_name.replace(xxx, ".txt"))
            
            if not os.path.exists(l_file_path):
                os.remove(i_file_path)

# Example usage:
i_directory = "D:/PythonProjects/revised_hot_work_classes6_task2/images/train"  # Replace with the actual directory path
l_directory = "D:/PythonProjects/revised_hot_work_classes6_task2/labels/train"
delete_empty_txt_files(i_directory, l_directory)